<template>
  <div class="h-panel">
    <PaasTitleBar></PaasTitleBar>
    <div class="h-panel-body bottom-line">
      <Form ref="form" :validOnChange="true" :showErrorTip="true" labelPosition="left" :labelWidth="110" :rules="vRules" :model="model" mode="twocolumn">
        <FormInput label="团队名称" prop="name" v-model="model.name"></FormInput>
        <FormPageSelect label="团队成员" prop="memberIds" v-model="model.memberIds" url="/sysusers/select" :multiple="true"></FormPageSelect>
      </Form>
    </div>
    <PaasButtonBar></PaasButtonBar>
  </div>
</template>
</template>

<script>
export default {
  async mounted() {
    let id = this.$route.query.id;
    if (!!id) {
      this.model = await this.$store.dispatch("getFormData", id);

      this.model.memberIds = this.StaticFunc.split(this.model.memberIds);
    }
  },
  data() {
    return {
      model: {
        memberIds: "",
        name: "",
      },
      vRules: {
        required: ["memberIds", "name"],
      },
    };
  },
  methods: {
    validate() {
      this.model.memberIds = this.StaticFunc.join(this.model.memberIds);
    },
  },
  deactivated() {
    this.$destroy(true);
  },
};
</script>
